package com.sskj.mine.ui.activity;


import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.flyco.tablayout.SlidingTabLayout;
import com.sskj.common.base.App;
import com.sskj.lib.Constans;
import com.sskj.lib.RConfig;
import com.sskj.mine.R;
import com.sskj.mine.R2;
import com.sskj.mine.presenter.MineCoinRecordActivityPresenter;
import com.sskj.lib.base.BaseActivity;

import java.util.ArrayList;

import butterknife.BindView;

@Route(path = RConfig.MINE_ASSET_RECORDS)  // 充币提币记录
public class MineCoinRecordActivity extends BaseActivity<MineCoinRecordActivityPresenter> {
    @BindView(R2.id.slidingTabLayout)
    SlidingTabLayout slidingTabLayout;
    @BindView(R2.id.viewPager)
    ViewPager viewPager;
    private String[] titles = new String[]{App.INSTANCE.getString(R.string.mine_mineRechargeActivity1_j), App.INSTANCE.getString(R.string.mine_mineWithdrawActivity1_j), App.INSTANCE.getString(R.string.mine_mineCoinRecordActivity3_j)};
    @Autowired
    public int type;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_mine_coin_record;
    }

    @Override
    public MineCoinRecordActivityPresenter getPresenter() {
        return new MineCoinRecordActivityPresenter();
    }

    @Override
    protected void initView() {
        super.initView();
        ARouter.getInstance().inject(this);
        setTitle(App.INSTANCE.getString(R.string.mine_mineCoinRecordActivity4_j));
        ArrayList<Fragment> fragments = new ArrayList<>();
        fragments.add((Fragment) ARouter.getInstance().build(RConfig.MINE_FRAGMENT_ASSET).withInt(Constans.TYPE, 1).navigation()); //充币
        fragments.add((Fragment) ARouter.getInstance().build(RConfig.MINE_FRAGMENT_ASSET).withInt(Constans.TYPE, 0).navigation()); // 提币
        fragments.add((Fragment) ARouter.getInstance().build(RConfig.MINE_FRAGMENT_OTHER_ASSET).navigation());
        slidingTabLayout.setViewPager(viewPager, titles, this, fragments);
        switch (type) {
            case 0:
                slidingTabLayout.setCurrentTab(1);
                break;
            case 1:
                slidingTabLayout.setCurrentTab(0);
                break;
        }
    }
}
